package com.example.xjtuse_pc.mobilesafe.Atools;

import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.example.xjtuse_pc.db.dao.NumberAddressQueryUtils;
import com.example.xjtuse_pc.mobilesafe.R;

public class NumberAddressActivity extends Activity {
    private EditText editText;
    private TextView result;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_number_address);
        editText= (EditText) findViewById(R.id.editText);
        result= (TextView) findViewById(R.id.result);
    }


    public void query(View view) {
        String phone = editText.getText().toString().trim();
        if(TextUtils.isEmpty(phone)){
            Animation shake= AnimationUtils.loadAnimation(NumberAddressActivity.this, R.anim.shake);
            editText.startAnimation(shake);
            Toast.makeText(NumberAddressActivity.this,"内容为空",Toast.LENGTH_SHORT).show();
            return;
        }else{
            String results=NumberAddressQueryUtils.queryNumber(editText.getText().toString().trim());
            result.setText(results);
        }



    }
}
